import { Select } from "antd"
import { useDispatch, useSelector } from "react-redux"
import { useEffect } from "react"
import { getDetails } from "@/store/actions/details"
export const Channels = ({ value, onChange, width = 264 }) => {
  const dispatch = useDispatch()
  const channels=useSelector(state=>state.details.channels)
  useEffect(()=>{dispatch(getDetails())},[dispatch])
  return (
    <Select placeholder="请选择文章频道" style={{width}} value={value} onChange={onChange}>
    {channels.map(item=>{return <Select.Option key={item.id} value={item.name}>{item.name}</Select.Option>})}
  </Select>
  )
}